Hello together, |
Re: update Attributes via dxl script It is highly recommended that you test this on a copy of the project to make sure that you understand how this works and that it make changes according to your expectations. I don't know what sort of changes you are wanting to make so experiment first to make sure it does what you expect it to do. In particular, be careful with removing or changing the text of existing enumerated elements, this will the an effect of removing these from objects that have selected these elements as values for that attribute - they will not appear in history as being deleted, they will just disappear without any trace - so be careful. Paul Miller Melbourne, Australia Attachments attachment_14627464_CopyAttrsPlus_v2.dxl |
Re: update Attributes via dxl script SystemAdmin - Tue Jun 14 03:51:01 EDT 2011 Paul Miller Melbourne, Australia thank you so much for this very fast answer and it works like honey milk. Love it! Thanks a lot! Cheers, Manuel |
Re: update Attributes via dxl script the script worked until now with now problems. But now I have a problem with the update of types from one module to another if there are already types available. The script deletes the types in the target module and writes the types out of the source module into the target module. But I want to keep the types which are already inside the source module. I think I have to modify this part of the script, but can't get it working: //================================================================================================= // Creates types for use by attributes yet to be created in the target module. // // Called by: copyAtts // // Calls: storeMsg // bool createType(Module srcMod, Module destMod, string nameOfType) { bool boundSet, passed = false string errMsg = null AttrType destAttType AttrType attType = find(srcMod, nameOfType) string baseType = attType.type "" current = destMod if (baseType == "Real") { destAttType = create(attType.name, attrReal, errMsg) boundSet = attType.minValue if (boundSet) { real minVal = attType.minValue setMinValue(destAttType, minVal, true) } boundSet = attType.maxValue if (boundSet) { real maxVal = attType.maxValue setMaxValue(destAttType, maxVal, true) } } else if (baseType == "Integer") { destAttType = create(attType.name, attrInteger, errMsg) boundSet = attType.minValue if (boundSet) { int minVal = attType.minValue setMinValue(destAttType, minVal, true) } boundSet = attType.maxValue if (boundSet) { int maxVal = attType.maxValue setMaxValue(destAttType, maxVal, true) } } else if (baseType == "Date") { destAttType = create(attType.name, attrDate, errMsg) boundSet = attType.minValue if (boundSet) { Date minVal = attType.minValue setMinValue(destAttType, minVal, true) } boundSet = attType.maxValue if (boundSet) { Date maxVal = attType.maxValue setMaxValue(destAttType, maxVal, true) } } else if (baseType == "String") { destAttType = create(attType.name, attrString, errMsg) } else if (baseType == "Text") { destAttType = create(attType.name, attrText, errMsg) } else if (baseType == "Enumeration") { string optionshttp://attType.size int valshttp://attType.size int colshttp://attType.size bool keepVals = false for (i = 0; i < attType.size; i++) { options[i] = attType.strings[i] vals[i] = attType.values[i] cols[i] = attType.colors[i] if (i != vals[i]) { keepVals = true } } if (keepVals) { destAttType=create(attType.name, options, vals, cols, errMsg) } else { destAttType=create(attType.name, options, errMsg) } } else { storeMsg("\tUnable to create type '" attType.name "' due to unknown base type '" baseType "'") } if (null errMsg) { passed = true if(get(accessOptnDBE)==true) { //modify access rights if true modTypeAccess(srcMod, destMod, attType, destAttType) } } else { storeMsg("\tUnable to create type:\n" errMsg) } return passed } // createType Can someone help me? Thanks a lot! |